<template>

  <a-modal :title="title"
           :width="800"
           :visible="listVisible"
           @ok="handleCancel"
           @cancel="listVisible=false"
           cancelText="关闭"
  >

    <a-card :bordered="false">

      <!-- table区域 -->
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="orderInfo"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">



          <span slot="action" slot-scope="text, record" >

            <a @click="handleOrder(record)">事件记录</a>

        </span>
      </a-table>

    </a-card>
  </a-modal>




</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { mixinDevice } from '@/utils/mixin'

import WxUserinfoModal from '@/views/wuser/WxUserinfoModal'
import Area from '@comp/_util/Area'
import { getAction } from '@api/manage'
import PatientDataModal from '../../patient/modules/PatientDataModal'
// import OrderIndexModal from  '@views/order/modules/OrderIndexModal'

export default {
  name: "SettlementIndexModal",


  mixins:[JeecgListMixin, mixinDevice],
  components: {
    WxUserinfoModal,
    PatientDataModal,
    // OrderIndexModal
  },
  data () {
    return {
      description: 'doctor_assistant管理页面',
      title:"结算详情",
      listVisible:false,
      visible: false,
      doctorId:'',
      labelCol: {
        xs: { span: 8 },
        sm: { span: 8 },

      },
      wrapperCol: {
        xs: { span: 20 },
        sm: { span: 16 },
      },
      orderInfo:{},
      columns: [
        {
          title:'结算ID',
          align:"center",
          dataIndex: 'settlementId'
        },
        {
          title:'结算详情类型',
          align:"center",
          dataIndex: 'type',
          customRender:function (res) {
            var status = "";
            if(res == 1){
              status = "平台";
            }else if(res == 2){
              status = "医生";
            }
            return status;
          }
        },
        {
          title:'结算金额',
          align:"center",
          dataIndex: 'settlementAmount'
        },
        {
          title:'分成比例',
          align:"center",
          dataIndex: 'ratio'
        },
        {
          title:'创建时间',
          align:"center",
          dataIndex: 'createTime',
          customRender:function (text) {
            return !text?"":(text.length>10?text.substr(0,10):text)
          }
        },
      ],
      url: {
        list: "/doctor/doctorAssistantRelation/doctorList",
        queryDetail: "/settlement/settlementDetail/queryDetail",

      },

    }
  },
  created() {
    this.showSettlement();
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    initDictConfig(){
    },
    showSettlement(record){

      let param = {};

      param.settlementId = record.id;

      getAction(this.url.queryDetail,param).then(res=>{
        this.orderInfo = res.result;
      })
      this.listVisible = true;
    },
    handleCancel(){
      this.listVisible = false;
    },
    handleOrder(record){
      this.$refs.orderModal.showOrder(record);
    }

  }

}
</script>

<style scoped>
@import '~@assets/less/common.less';
</style>